<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>vue 动画封装</title>
    <script src="./vue.js"></script>
    
</head>
<body>
    <div id="app">
        <face :show="show">
            <h1>hello world</h1>
        </face>
        
        <button @click="btn">btn</button>
    </div>
    <script>
        Vue.component('face',{
            props: ['show'],
            template: `<transition @before-enter="benter" @enter="enter">
            <slot v-if="show"></slot>
            </transition>`,
            methods: {
                benter: function(el){
                    el.style.color = 'red'
                },
                enter: function(el,done){
                    setTimeout(()=>{
                        el.style.color='green'
                        done()
                    },2000)    
                }
            }
        })
        var vm = new Vue({
            el: '#app',
            data: {
              show: false  
            },
            //方法
            methods:{
                btn: function(){
                    this.show = !this.show
                }
               
            },
            //组件
            components: {
                
            },
            //计算属性
            computed:{
               
            }


        })
    </script>
</body>
</html>